<template>
	<view class="columnbox wdh-100 content">
		<view @click="chooseAccount(item)" class="rowbox c-box spb" v-for="(item,index) in infolist" :key='index'>
			<!-- <image class="c-img" src="/static/logo.png" mode="widthFix"></image> -->
			<view class="rowbox">
				<image v-if="item.alipay!=''" class="icon" src="/static/img/zfb.png" mode="widthFix"></image>
				<image v-else class="icon" src="/static/img/yl.png" mode="widthFix"></image>
				<view class="columnbox als spb">
					<view v-if="item.alipay!=''" class="columnbox c-info als">
						<view>支付宝帐号</view>
						<view style="font-size: 24rpx; color: #797a7a;">{{item.name}} {{item.alipay}}</view>
					</view>
					<view v-else class="columnbox c-info als">
						<view>{{item.khh}}</view>
						<view style="font-size: 24rpx;color: #797a7a;">卡号 {{item.bank}}</view>
					</view>
				</view>
			</view>
			<view class="rowbox" @click="updateInfo(item.id)">
				<u-icon name="edit-pen" size="32rpx" color="#797a7a"></u-icon>
				<view class="edit-btn">修改</view>
			</view>
		</view>
		<view class="add-box rowbox spb" @click="toAdd">
			<view class="rowbox">
				<view class="rowbox add-icon">
					<u-icon name="plus" size="28rpx" color="#00b6b2"></u-icon>
				</view>
				添加提现账户
			</view>
			<u-icon name="arrow-right" size="28rpx"></u-icon>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				infolist: [],
				from: ''
			};
		},
		onShow() {
			this.getInfo()
		},
		onLoad(options) {
			if (options.from) {
				this.from = options.from
			}
		},
		methods: {
			updateInfo(id) {
				uni.navigateTo({
					url: '/pages/wallet/addAccount?id=' + id
				})
			},
			chooseAccount(v) {
				if (this.from == 'withdraw') {
					let pages = getCurrentPages(); //获取所有页面栈实例列表
					let nowPage = pages[pages.length - 1]; //当前页页面实例
					let prevPage = pages[pages.length - 2]; //上一页页面实例
					prevPage.$vm.account = v
					uni.navigateBack()
				}
			},
			getInfo() {
				this.$req.post('/doctor/banks', {
					doctorid: uni.getStorageSync('uid')
				}).then(res => {
					this.infolist = res.data.data
				})
			},
			toAdd() {
				uni.navigateTo({
					url: '/pages/wallet/addAccount'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		min-height: 100vh;
		background: #F5F8FB;
		justify-content: flex-start;
	}

	.c-box {
		background: #fff;
		width: 700rpx;
		margin-top: 20rpx;
		padding: 32rpx 40rpx;
		border-radius: 10rpx;
		font-weight: 500;
		border: #eff1f8 solid 1px;

		.c-img {
			width: 70rpx;
			height: 70rpx;
		}

		.c-info {
			margin-left: 20rpx;
			line-height: 45rpx;
			font-size: 28rpx;
			color: #1b1b1b;
		}
	}

	.add-box {
		width: 700rpx;
		margin-top: 20rpx;
		padding: 32rpx 40rpx;
		border-radius: 10rpx;
		background: #fff;
		font-size: 28rpx;
	}

	.add-icon {
		background: rgba(#00b6b2, .1);
		width: 70rpx;
		height: 70rpx;
		border-radius: 100rpx;
		margin-right: 20rpx;
	}

	.icon {
		width: 70rpx;
		height: 70rpx;
		margin-right: 10rpx;
	}

	.edit-btn {
		font-weight: normal;
		font-size: 24rpx;
		margin-left: 10rpx;
		color: #797a7a;
	}
</style>